/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package RootDesc.impl;

import RootDesc.MethodOperation;
import RootDesc.RootDescPackage;
import RootDesc.TestDescription;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Test Description</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link RootDesc.impl.TestDescriptionImpl#getOperation <em>Operation</em>}</li>
 *   <li>{@link RootDesc.impl.TestDescriptionImpl#getStateCondition <em>State Condition</em>}</li>
 *   <li>{@link RootDesc.impl.TestDescriptionImpl#getGuardCondition <em>Guard Condition</em>}</li>
 *   <li>{@link RootDesc.impl.TestDescriptionImpl#getTargetCondition <em>Target Condition</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TestDescriptionImpl extends EObjectImpl implements TestDescription {
  /**
   * The cached value of the '{@link #getOperation() <em>Operation</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOperation()
   * @generated
   * @ordered
   */
  protected MethodOperation operation;

  /**
   * The default value of the '{@link #getStateCondition() <em>State Condition</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getStateCondition()
   * @generated
   * @ordered
   */
  protected static final String STATE_CONDITION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getStateCondition() <em>State Condition</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getStateCondition()
   * @generated
   * @ordered
   */
  protected String stateCondition = STATE_CONDITION_EDEFAULT;

  /**
   * The default value of the '{@link #getGuardCondition() <em>Guard Condition</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getGuardCondition()
   * @generated
   * @ordered
   */
  protected static final String GUARD_CONDITION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getGuardCondition() <em>Guard Condition</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getGuardCondition()
   * @generated
   * @ordered
   */
  protected String guardCondition = GUARD_CONDITION_EDEFAULT;

  /**
   * The default value of the '{@link #getTargetCondition() <em>Target Condition</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTargetCondition()
   * @generated
   * @ordered
   */
  protected static final String TARGET_CONDITION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getTargetCondition() <em>Target Condition</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTargetCondition()
   * @generated
   * @ordered
   */
  protected String targetCondition = TARGET_CONDITION_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected TestDescriptionImpl() {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass() {
    return RootDescPackage.Literals.TEST_DESCRIPTION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MethodOperation getOperation() {
    if (operation != null && operation.eIsProxy()) {
      InternalEObject oldOperation = (InternalEObject)operation;
      operation = (MethodOperation)eResolveProxy(oldOperation);
      if (operation != oldOperation) {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, RootDescPackage.TEST_DESCRIPTION__OPERATION, oldOperation, operation));
      }
    }
    return operation;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MethodOperation basicGetOperation() {
    return operation;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setOperation(MethodOperation newOperation) {
    MethodOperation oldOperation = operation;
    operation = newOperation;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, RootDescPackage.TEST_DESCRIPTION__OPERATION, oldOperation, operation));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getStateCondition() {
    return stateCondition;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setStateCondition(String newStateCondition) {
    String oldStateCondition = stateCondition;
    stateCondition = newStateCondition;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, RootDescPackage.TEST_DESCRIPTION__STATE_CONDITION, oldStateCondition, stateCondition));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getGuardCondition() {
    return guardCondition;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setGuardCondition(String newGuardCondition) {
    String oldGuardCondition = guardCondition;
    guardCondition = newGuardCondition;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, RootDescPackage.TEST_DESCRIPTION__GUARD_CONDITION, oldGuardCondition, guardCondition));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getTargetCondition() {
    return targetCondition;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTargetCondition(String newTargetCondition) {
    String oldTargetCondition = targetCondition;
    targetCondition = newTargetCondition;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, RootDescPackage.TEST_DESCRIPTION__TARGET_CONDITION, oldTargetCondition, targetCondition));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID) {
      case RootDescPackage.TEST_DESCRIPTION__OPERATION:
        if (resolve) return getOperation();
        return basicGetOperation();
      case RootDescPackage.TEST_DESCRIPTION__STATE_CONDITION:
        return getStateCondition();
      case RootDescPackage.TEST_DESCRIPTION__GUARD_CONDITION:
        return getGuardCondition();
      case RootDescPackage.TEST_DESCRIPTION__TARGET_CONDITION:
        return getTargetCondition();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue) {
    switch (featureID) {
      case RootDescPackage.TEST_DESCRIPTION__OPERATION:
        setOperation((MethodOperation)newValue);
        return;
      case RootDescPackage.TEST_DESCRIPTION__STATE_CONDITION:
        setStateCondition((String)newValue);
        return;
      case RootDescPackage.TEST_DESCRIPTION__GUARD_CONDITION:
        setGuardCondition((String)newValue);
        return;
      case RootDescPackage.TEST_DESCRIPTION__TARGET_CONDITION:
        setTargetCondition((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID) {
    switch (featureID) {
      case RootDescPackage.TEST_DESCRIPTION__OPERATION:
        setOperation((MethodOperation)null);
        return;
      case RootDescPackage.TEST_DESCRIPTION__STATE_CONDITION:
        setStateCondition(STATE_CONDITION_EDEFAULT);
        return;
      case RootDescPackage.TEST_DESCRIPTION__GUARD_CONDITION:
        setGuardCondition(GUARD_CONDITION_EDEFAULT);
        return;
      case RootDescPackage.TEST_DESCRIPTION__TARGET_CONDITION:
        setTargetCondition(TARGET_CONDITION_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID) {
    switch (featureID) {
      case RootDescPackage.TEST_DESCRIPTION__OPERATION:
        return operation != null;
      case RootDescPackage.TEST_DESCRIPTION__STATE_CONDITION:
        return STATE_CONDITION_EDEFAULT == null ? stateCondition != null : !STATE_CONDITION_EDEFAULT.equals(stateCondition);
      case RootDescPackage.TEST_DESCRIPTION__GUARD_CONDITION:
        return GUARD_CONDITION_EDEFAULT == null ? guardCondition != null : !GUARD_CONDITION_EDEFAULT.equals(guardCondition);
      case RootDescPackage.TEST_DESCRIPTION__TARGET_CONDITION:
        return TARGET_CONDITION_EDEFAULT == null ? targetCondition != null : !TARGET_CONDITION_EDEFAULT.equals(targetCondition);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString() {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (stateCondition: ");
    result.append(stateCondition);
    result.append(", guardCondition: ");
    result.append(guardCondition);
    result.append(", targetCondition: ");
    result.append(targetCondition);
    result.append(')');
    return result.toString();
  }

} //TestDescriptionImpl
